<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script>
			var arr = [12,54,5,69,78,131,456,978,645,32,564];
		/*	
		 * 冒泡排序
		 * for(var i=0;i<arr.length;i++){
				for(var j=0;j<arr.length-i;j++){
					if(arr[j]>arr[j+1]){
						var max = arr[j];
						arr[j] = arr[j+1];
						arr[j+1] = max;
					}
				}
			}*/
			/*
			 * 选择排序
			 * for(var i=0;i<arr.length;i++){
				for(var j=i;j<arr.length;j++){
					if (arr[i]>arr[j]) {
					  var max=arr[i];
						arr[i]=arr[j];
						arr[j]=max;
					}

				}
			}*/
			
			document.write(arr)
		</script>
	</body>
</html>
